#ifndef __CPPDARRAY_H_
#define __CPPDARRAY_H_
#include <iostream>
#define ElementType void*
#define INITDARRAY(a)  DArray a;InitDynamicArray(&a);

class DynamicArray
{
public:
    DynamicArray(void(*CLearptr)(ElementType));
    ~DynamicArray();

    bool InsertArrayTail(ElementType element);
    void DisplayDynamicArray(void(*Printptr)(ElementType));
    bool RemoveByIndex(int index);
    bool RemoveArray_ByElement(ElementType element,bool(*Compareptr)(ElementType,ElementType));
    void Sort(bool(*Compareptr)(ElementType,ElementType));
    DynamicArray FindByElement(ElementType element,bool(*funcptr)(ElementType,ElementType));
    bool RemoveFirstArray_ByElement(ElementType element,bool(*Compareptr)(ElementType,ElementType));
    
private:
    ElementType* dp;  //动态数组指针
    int size;       //容量
    int len;         //长度
    void(*CLearptr)(ElementType); //用户自定义的clear函数指针
};

#endif